{extend name="public/base" /}
{block name="css"}
<link rel="stylesheet" href="__INDEX__/css/create.css">
<link href="__PLUGIN__/Fileinput/css/fileinput.css" rel="stylesheet">
<style>
.col-sm-12{padding:0px;}
</style>
{/block}
{block name="container"}
<div class="panel-body panel-body-nopadding" style="padding-bottom:50px;">
    <div class="inforMain">基本信息</div>
    <div class="tishiform">*请注意！必须填写好客户名称和注记简称，并点击精确搜索，系统检测无相似信息后，才会出现提交保存按钮</div>
    <form class="form-horizontal form-bordered" id="submitForm" onsubmit ="getElementById('submitInput').disabled=true;return true;" action="" method="post"  > 
        <div class="form-group">
            <label class="col-sm-1 control-label"><span>*</span>客户名称：</label>
            <div class="col-sm-2">
                <input type="text" class="form-control" placeholder="客户名称" name="cust[name]" value=""  required>
            </div>
            <label class="col-sm-1 control-label"><span>*</span>联系电话：</label>
            <div class="col-sm-3" >
                <input type="text" class="form-control" placeholder="联系电话" name="cust[phone]" value=""  required>
            </div>
        </div>
        
        <div class="form-group">
            <label class="col-sm-1 control-label"><span>*</span>性&emsp;&emsp;别：</label>
            <div class="col-sm-2" >
                <input type="radio" value="1" name="cust[sex]" style="margin-top: 10px;margin-right: 8px;">男 
                <input type="radio" value="2" name="cust[sex]" style="margin-left:30px;margin-top: 10px;margin-right: 8px">女
            </div>
            <label class="col-sm-1 control-label"><span>*</span>年&emsp;&emsp;龄：</label>
            <div class="col-sm-3">
                <input type="text" class="form-control" placeholder="年龄" name="cust[age]" value=""  required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-1 control-label"><span>*</span>收货地址：</label>
            <div class="col-sm-2">
                <select   name="cust[province]" class="form-control" id="province" onchange="getRegion(this.value,1)">
                    <option value="-1">省份</option>
                    {volist name="prov" id="pvo"}
                    <option value="{$pvo.code}">{$pvo.name}</option>
                    {/volist}
                </select>
            </div>
            <div class="col-sm-2">
                <select  name="cust[city]" id="city" class="form-control" onchange="getRegion(this.value,2)">
                    <option value="-1">城市</option>
                </select>
            </div>
            <div class="col-sm-2">
                <select name="cust[area]" class="form-control" id="area">
                    <option value="-1">县/区</option>
                </select>
            </div>        
        </div>
        <div class="form-group">
            <label class="col-sm-1 control-label"><span>*</span>详细地址：</label>
            <div class="col-sm-6">
                <input type="text" class="form-control" placeholder="详细地址" name="cust[address]" value=""  required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-1 control-label"><span>*</span>店&emsp;&emsp;铺：</label>
            <div class="col-sm-2">
                <select name="shop_id" id="shop_id" class="form-control" onchange="getInfo(this.value)">
                    <option value="-1">店铺</option>
                    {volist name="shop" id="v"}
                    <option value="{$v.id}">{$v.title}</option>
                    {/volist}
                </select>
            </div>
            <div class="col-sm-1">
                <select name="user_id" class="form-control" id="user_id" required>
                    <option value="-1">姓名</option>
                </select>
            </div>
            <label class="col-sm-1 control-label"><span>*</span>等&emsp;&emsp;级：</label>
            <div class="col-sm-2">
                <select name="cust[level]" class="form-control" id="level">
                    <option value="-1">---等级---</option>
                    {volist name="level" id="vo"}
                    <option value="{$vo.id}">{$vo.title}</option>
                    {/volist}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-1 control-label"><span>*</span>客户来源：</label>
            <div class="col-sm-11" >
                <input type="radio" value="1" name="cust[from]" style="margin-top: 10px;margin-right: 8px;" required>个人查找
                <input type="radio" value="2" name="cust[from]" style="margin-left:30px;margin-top: 10px;margin-right: 8px" required>老客户介绍
                <input type="radio" value="3" name="cust[from]" style="margin-left:30px;margin-top: 10px;margin-right: 8px" required>公司派单
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-1 control-label"><span>*</span>新老客户：</label>
            <div class="col-sm-11" >
                <input type="radio" value="1" name="cust[is_New]" style="margin-top: 10px;margin-right: 8px;">新客户
                <input type="radio" value="0" name="cust[is_New]" style="margin-left:30px;margin-top: 10px;margin-right: 8px">老客户
            </div>
        </div>
        <div class="inforliang">量体信息</div>
        <div class="form-group">
            <label class="col-sm-12 control-label" style="background: #7F7F7F;text-align: center;color: #000;">量体信息</label>
            <div  >
                <table class="table">
                 <tr >
                     <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000;border-left: 1px solid #000;">部位</th>
                     <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">净尺寸</th>
                     <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">成品尺寸</th>
                     <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">部位</th>
                     <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">净尺寸</th>
                     <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">成品尺寸</th>
                     <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">部位</th>
                     <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">净尺寸</th>
                     <th class="col-sm-1" style="text-align:center;box-sizing:border-box;border-right:1px solid #000000;border-bottom: 1px solid #000; ">成品尺寸</th>
                 </tr>
                 <tr  >
                     <td >1.身高</td>
                     <td><input type="text" name="jing[height]" class="form-control" required></td>
                     <td><input type="text" name="cheng[height]"></td>
                     <td>16.右袖长</td>
                     <td><input type="text" name="jing[right_sleeve]" class="form-control" required></td>
                     <td><input type="text" name="cheng[right_sleeve]"></td>
                     <td colspan="3">肩型</td> 
                 </tr>
                 <tr>
                   <td >2.体重</td>
                   <td><input type="text" name="jing[weight]"  required style="width: 26%">kg</td>
                   <td><input type="text" name="cheng[weight]" ></td>
                   <td>17.后腰节</td>
                   <td><input type="text" name="jing[b_lumbar]" class="form-control" required></td>
                   <td><input type="text" name="cheng[b_lumbar]"></td>
                   <td colspan="3">
                    左：<input type="text" style="display: inline-block;width: 25px" name="jing[st_left]"  required>
                    右：<input type="text" style="display: inline-block;width: 25px" name="jing[st_right]" required> 
                </td>   
            </tr>
            <tr>
               <td >3.领围</td>
               <td><input type="text" name="jing[neck]" class="form-control" required></td>
               <td><input type="text" name="cheng[neck]"></td>
               <td>18.后衣长</td>
               <td><input type="text" name="jing[b_coat]" class="form-control" required></td>
               <td><input type="text" name="cheng[b_coat]"></td>
               <td colspan="3">肚型</td>   
           </tr>
           <tr>
               <td >4.胸围</td>
               <td><input type="text" name="jing[bust]" class="form-control" required></td>
               <td><input type="text" name="cheng[bust]" ></td>
               <td>19.后腰高</td>
               <td><input type="text" name="jing[bl_height]" class="form-control" required></td>
               <td><input type="text" name="cheng[bl_height]"></td>
               <td colspan="3">
                <input type="radio" name="jing[belly]" value="1" style="width: auto;">正常
                <input type="radio" name="jing[belly]" value="2" style="width: auto;">凸肚
            </td>   
        </tr>
        <tr>
           <td >5.中腰围</td>
           <td><input type="text" name="jing[middle_waist]" class="form-control" required></td>
           <td><input type="text" name="cheng[middle_waist]"></td>
           <td>20.前腰节</td>
           <td><input type="text" name="jing[a_lumbar]" class="form-control" required></td>
           <td><input type="text" name="cheng[a_lumbar]"></td>
           <td colspan="3">臂型</td>   
       </tr>
       <tr>
           <td >6.裤腰围</td>
           <td><input type="text" name="jing[pants_waist]" class="form-control" required></td>
           <td><input type="text" name="cheng[pants_waist]"></td>
           <td>21.前腰高</td>
           <td><input type="text" name="jing[al_height]" class="form-control" required></td>
           <td><input type="text" name="cheng[al_height]"></td>
           <td colspan="3">
            <input type="radio" name="jing[arm]" value="1" style="width: auto;">正常
            <input type="radio" name="jing[arm]" value="2" style="width: auto;">手臂靠后
        </td>   
    </tr>
    <tr>
       <td >7.臀围</td>
       <td><input type="text" name="jing[hipline]" class="form-control" required></td>
       <td><input type="text" name="cheng[hipline]"></td>
       <td>22.裤长</td>
       <td><input type="text" name="jing[trousers]" class="form-control" required></td>
       <td><input type="text" name="cheng[trousers]"></td>
       <td colspan="3">臀型</td>   
   </tr>
   <tr>
       <td >8.腿根围</td>
       <td><input type="text" name="jing[leg_size]" class="form-control" required></td>
       <td><input type="text" name="cheng[leg_size]"></td>
       <td>23.腰膝长</td>
       <td><input type="text" name="jing[wk_length]" class="form-control" required></td>
       <td><input type="text" name="cheng[wk_length]"></td>
       <td colspan="3">
        <input type="radio" name="jing[buttocks]" value="1" style="width: auto;">正常
        <input type="radio" name="jing[buttocks]" value="2" style="width: auto;">翘臀
        <input type="radio" name="jing[buttocks]" value="3" style="width: auto;">坠臀
    </td>   
</tr>
<tr>
   <td >9.通档</td>
   <td><input type="text" name="jing[tongdang]" class="form-control" required></td>
   <td><input type="text" name="cheng[tongdang]"></td>
   <td>24.膝围</td>
   <td><input type="text" name="jing[knee]" class="form-control" required></td>
   <td><input type="text" name="cheng[knee]"></td>
   <td colspan="3"></td>   
</tr>
<tr>
   <td >10.上臂围</td>
   <td><input type="text" name="jing[upper_arm]" class="form-control" required></td>
   <td><input type="text" name="cheng[upper_arm]"></td>
   <td>25.腿肚围</td>
   <td><input type="text" name="jing[calf_length]" class="form-control" required></td>
   <td><input type="text" name="cheng[calf_length]"></td>
   <td colspan="3"></td>   
</tr>
<tr>
   <td >11.左腕围</td>
   <td><input type="text" name="jing[left_wrist]" class="form-control" required></td>
   <td><input type="text" name="cheng[left_wrist]"></td>
   <td>26.脚口</td>
   <td><input type="text" name="jing[foot]" class="form-control" required></td>
   <td><input type="text" name="cheng[foot]"></td>
   <td colspan="3"></td>   
</tr>
<tr>
   <td >12.右腕围</td>
   <td><input type="text" name="jing[right_wrist]" class="form-control" required></td>
   <td><input type="text" name="cheng[right_wrist]"></td>
   <td>27.胸高</td>
   <td><input type="text" name="jing[th_height]" class="form-control" required></td>
   <td><input type="text" name="cheng[th_height]"></td>
   <td colspan="3"></td>   
   </tr
   <tr>
       <td >13.总肩宽</td>
       <td><input type="text" name="jing[shoulder]" class="form-control" required></td>
       <td><input type="text" name="cheng[shoulder]"></td>
       <td>28.胸距</td>
       <td><input type="text" name="jing[th_distance]" class="form-control" required></td>
       <td><input type="text" name="cheng[th_distance]"></td>
       <td colspan="3"></td>   
   </tr>
   <tr>
       <td >14.前肩宽</td>
       <td><input type="text" name="jing[front_shoulder]" class="form-control" required></td>
       <td><input type="text" name="cheng[front_shoulder]"></td>
       <td>29.前胸宽</td>
       <td><input type="text" name="jing[across_front]" class="form-control" required></td>
       <td><input type="text" name="cheng[across_front]"></td>
       <td colspan="3"></td>   
   </tr>
   <tr>
       <td >15.左袖长</td>
       <td><input type="text" name="jing[left_sleeve]" class="form-control" required></td>
       <td><input type="text" name="cheng[left_sleeve]"></td>
       <td>30.后背宽</td>
       <td><input type="text" name="jing[across_back]" class="form-control" required></td>
       <td><input type="text" name="cheng[across_back]"></td>
       <td colspan="3"></td>   
   </tr>


</table>
</div>  
</div>
<div class="form-group">
    <label class="col-sm-12 control-label" style="background: #7F7F7F;text-align: center;color: #000;">订单信息
        <div style="display: inline-block;background: #7F7F7F;padding-right: 20px;float: right;font-size: 12px">产品编号: <input type="text" style="background: #7F7F7F;border:0" name="order[pro_num]" required ></div>
    </label>
    <div class="col-sm-12" >
        <table class="table ">
            <tr>
                <td>品类</td>
                <td colspan="8">
                    {volist name="category" id="vo"}
                    <input type="radio" value="{$vo.id}" name="order[category_id]" style="width: auto;" onclick="get_style_num(this.value)">{$vo.title}
                    {/volist}
                </td>
            </tr>
            <tr>
               <td >款式编号</td>
               <td colspan="2"> <input type="text" name="order[style_num]" required style="width: 100%" readonly></td>
               <td>面料编号</td>
               <td colspan="2"><input type="text" name="order[ml_num]" required style="width: 100%"></td>
               <td>订单属性</td>
               <td colspan="2" style="display: flex;justify-content: center;">
                 <input type="radio" value="" name="order[shuxing]" style="width: auto;margin-left: 10px;"><p style="color: #676a6c !important;" required>正常订单</p>
                 <input type="radio" value="" name="order[shuxing]" style="width: auto;"><p style="color: #676a6c !important;" required>售后订单</p>
               </td>
           </tr>
           <tr>
               <td >款式细节</td>
               <td  colspan="8" >
                <textarea name="order[detail]"  cols="30" rows="10" style="border:0px;width: 100%;outline: none;resize: none;"></textarea>
            </td>
        </tr>
        <tr>
            <td>着装风格</td>
            <td colspan="8">
                {volist name="style" id="vo"}
                <input type="radio" style="display: inline-block;width: auto;" name="order[yifu_style]" value="{$vo.id}" {if condition="$vo['id'] eq 3"} checked {/if}>{$vo.name}
                {/volist}
            </td>
        </tr>
        <tr>
           <td>特殊备注</td>
           <td colspan="4"><input type="text" style="width: 100%;" name="order[comment]"></td>
           <td>加急</td>
           <td colspan="3">
               <input type="radio" style="display: inline-block;width: auto;" name="order[is_urgent]" value="1">是
               <input type="radio" style="display: inline-block;width: auto;" name="order[is_urgent]" value="0">否
               <div style="display: inline-block;">加急<input type="text" style="width: 25px;" name="order[urgent_num]">天</div>
           </td>
       </tr>
       <tr>
           <td >订单金额</td>
           <td colspan="1" ><input type="text" name="order[price]" required></td>
           <td >实付金额</td>
           <td colspan="1"><input type="text" name="order[true_price]" required></td>
           <td>是否代加工</td>
           <td colspan="4" style="padding: 0px;">
             <input type="radio" class="is_ok" style="display: inline-block;width: auto;padding: 8px 0" name="order[is_dai]" value="1" >是
               <input type="radio" class="is_ok" style="display: inline-block;width: auto;padding: 8px 0" name="order[is_dai]" value="0">否
               <div style="display: none;float: right;width: 50%;"id="gongchang">选择工厂<select name="order[gongchang]"  style="width: 65%;outline: none;margin-left: 10px;border: 0px; ">
                <option value="-1">请选择工厂</option>
                  <option value="1">红岭</option>
                  <option value="2">如意</option>
                  <option value="3">鲁泰</option>
               </select></div>
           </td>
       </tr>
       <tr>
            <td colspan="1">付款方式</td>
            <td colspan="8">
                    <input class="is_dian" type="radio" name="order[payment]" value="1" style="display: inline-block;width: auto;padding: 1px">普通支付
                    <input class="is_dian" type="radio" name="order[payment]" value="0" style="display: inline-block;width: auto;padding: 1px">会员卡支付
                <div style="display: inline-block;">

                    <span id="huiyuan" style="display: none;margin-left: 30px;">
                        卡号：<input type="text" name="order[card_num]" id="card_num" style="display: inline-block;width: auto;padding:1px ">
                        余额：<input type="text" name="order[money]" id="money" readonly style="display: inline-block;width: auto;padding:1px ">
                        密码：<input type="password" name="pass" id="pass" style="display: inline-block;width: auto;padding:1px ">
                    </span>
                </div>
            </td>
        </tr>
       <tr></tr>
   </table>
</div>  
</div>
<div class="form-group">
    <label class="col-sm-3 control-label">付款凭证：</label>
    <div class="col-sm-6">
        <input id="fileone" type="file" class="file-loading">
        <input type="hidden" id="picurl" placeholder="缩略图" name="order[picurl]" value="{$order.picurl ?? ''}">
    </div>
</div>
<div class="form-group">
    <label class="col-sm-3 control-label">客户组图：</label>
    <div class="col-sm-6">
       <input id="filepic" type="file" multiple >
   </div>
</div>
<div class="panel-footer">
  <div class="row">
   <div class="col-sm-6 col-sm-offset-3">
     <input type="hidden" name="id" value="">
     <button type="submit" class="btn btn-primary" id="submitInput" style="display: block;margin:0 auto">提交</button>
     <!--  <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);" style="margin:0 auto">返回</button> -->
 </div>
</div>
</div><!-- panel-footer --> 
</form>
</div>
{/block}
{block name="js"}
<script src="__PLUGIN__/Fileinput/js/fileinput.js"></script>
<script>
 $(document).ready(function() {
    fileinputOne("fileone","picurl");
    fileinputMore('filepic','picimg[]','picarr[]');
});
 // 支付方式
  $(".is_dian").click(function(){
      if($(this).val() == 1){
          $('#huiyuan').css('display','none')
      }else{
          $('#huiyuan').css('display','block')
      }
      
  })

</script>
<script>
  
  function get_style_num(id)
  {
    
    /*通过js获取年份*/
    var myDate = new Date();
    var y = myDate.getFullYear();  //获取当前年份
    var m = myDate.getMonth()+1;       //获取当前月份(0-11,0代表1月)
    if(m<10){
      m = '0'+m;
    }
    var d = myDate.getDate();        //获取当前日(1-31)
    var nian =  y+"" + m +""+d;
    nian = nian.substring(2);
    /*获取性别*/
    var sex = $('input:radio[name="cust[sex]"]:checked').val(); 
    if(sex == 1){
      var xing = 'M';
    }else{
      var xing = 'W';
    }
    var str = 'X'+xing+''+nian+'-';
    $.post('{:url("index/order/getStyleNum")}', {id: id}, function(data) {
     var  style_num = str+data;
     $('input:text[name="order[style_num]"]').val(style_num);
    });
  }
</script>
<script>
    function fileinputOne(fileid,field){
      var widths = arguments[2] ? arguments[2] : 'auto';//设置默认的图片宽度
      var heights = arguments[3] ? arguments[3] : '160px';//设置默认的图片高度
      //单图上传
      var $input = $("#"+fileid);
      var $picurl = $("#"+field); 
      
      var $Preview =[];
      var $Config =[];
      if($picurl.val()!=''){
       $Preview =["<img class='kv-preview-data file-preview-image' style='width:"+widths+";height:"+heights+";' src='__ROOT__"+$picurl.val()+"'>"];
       $Config =[{key: 1}];
   }
   $input.fileinput({
      uploadUrl: "{:url('index/common/upload')}",
      deleteUrl: "{:url('index/common/updel')}",
      autoReplace: true,
      overwriteInitial: true,
      showUploadedThumbs: false,
      maxFileCount: 1,
      initialPreview: $Preview,
      initialPreviewConfig: $Config,
      layoutTemplates: {actionDelete: ''}, 
  }).on("filebatchselected", function(event, files) {
          $input.fileinput("upload");//选择后自动上传
      }).on('fileuploaded', function(event, data,previewId,index) {
           //alert(JSON.stringify(data));
           var dataObj=eval("("+data.response+")");
            if(dataObj['code']==0)
                  {  
               $picurl.val(dataObj['img']);
                  }
           else{
            swal("出错了", "上传失败,请刷新再试", "error");
               }
    }).on("filecleared", function(event, files) {
       $picurl.val('');
   });

}

//组图上传
function fileinputMore(fileid,picurlname,field){
      var widths = arguments[3] ? arguments[3] : 'auto';//设置默认的图片宽度
      var heights = arguments[4] ? arguments[4] : '160px';//设置默认的图片高度
      //组图上传
      var $input = $("#"+fileid);
      var $picimg = $("input[name='"+picurlname+"']");

      var $Preview =[];
      var $Config =[];
      $picimg.each(function(i,e){
       $Preview.push("<img class='kv-preview-data file-preview-image' style='width:"+widths+";height:"+heights+";' src='__ROOT__"+$(this).val()+"'>");
       $Config.push({caption: $(this).attr('flag'),show: $(this).attr('show'),size:0,url:"<input type='hidden' name='"+field+"' value='"+$(this).val()+"'>", key: i});

   });

      var footerTemplate = '<div class="file-thumbnail-footer">\n' +
      '   <div style="margin:5px 0">\n' +
      '       <input type="text" class="hidden" value="{show}" name="show[]"><input class="kv-input kv-new form-control input-sm text-center" value="{caption}" placeholder="填写注释" name="info[]">\n' +
      '   </div>\n' +
      '   <button type="button" class="kv-file-forward text-info header-left" title="前移"><i class="glyphicon glyphicon-chevron-left"></i></button>\n' +
      '   &nbsp;{size}&nbsp;\n' +
      '   <button type="button" class="kv-file-backward text-danger header-right" title="后移"><i class="glyphicon glyphicon-chevron-right"></i></button>\n' +
      '   <button type="button" class="kv-file-heart text-danger header-left" title="显示隐藏"><i class="glyphicon glyphicon-heart{show}"></i></button>\n' +
      '   {actions}\n' +
      '</div>';

      $input.fileinput({
          uploadUrl: "{:url('index/common/upload')}",
          deleteUrl: "{:url('index/common/updel')}",
          autoReplace: false,
          overwriteInitial: false,
          layoutTemplates: {footer: footerTemplate, size: '<samp><small>({sizeText})</small></samp>'},
          initialPreview: $Preview,
          initialPreviewConfig: $Config,
      }).on("filebatchselected", function(event, files) {
          $input.fileinput("upload");//选择后自动上传
      }).on('fileuploaded', function(event, data,previewId,index) {
            var dataObj=eval("("+data.response+")");
             if(dataObj['code']==0)
                 { 
           $('#'+previewId).append("<input type='hidden' name='"+field+"' value='"+dataObj['img']+"'>");
              }
              else{
        swal("出错了", "上传失败,请刷新再试", "error");
           }
});
  }
</script>
<script>
    function getRegion(val,level)
    {
      var $city = $("#city");
      var $area = $("#area");
      if(level=='1'){
        $city.html('<option value=""> --请选择市-- </option>');
        $city.val('');
    }
    $area.html('<option value=""> --请选择区-- </option>');
    $area.val('');
    $.post('{:url('index/common/getRegion')}', { pcode: val,level:level}, function(data) {
               var dataObj=eval("("+data+")");//转换为json对象   
               if(dataObj['code']==1){
                if(level=='1'){
                    $.each(dataObj['list'], function(i, item) {
                      $city.append('<option value="'+item['code']+'">'+item['name']+'</option>');
                  });
                }else{
                    $.each(dataObj['list'], function(i, item) {
                      $area.append('<option value="'+item['code']+'">'+item['name']+'</option>');
                  });
                }
            }
        });
}
</script>
<script>
    function getInfo(val)
    {
        var $user_id = $('#user_id');
        $user_id.html('<option value="-1"> --姓名-- </option>');
        $user_id.val('');
        $.post('{:url('index/common/getInfo')}', {id: val}, function(data) {
           var dataObj=eval("("+data+")");//转换为json对象  
           if(dataObj['code'] == 1){
             $.each(dataObj['list'], function(i, item) {
              $user_id.append('<option value="'+item['id']+'">'+item['truename']+'</option>');
          });
         }
     });
    }
</script>
<script>
  
   $(function () {
      $(".is_ok").click(function () {
          if ($(this).val() == 1) {
              //alert("选中了");
              $('#gongchang').css('display','block');
          }else{
            $('#gongchang').css('display','none');
          }
      });
      $("#submitForm").submit(function() {
        $(':submit',this).attr('disabled','disabled');
      });
      /*检查会员卡是否是系统的卡*/
     $('#card_num').keydown(function(event) {
       if(event.keyCode == '13')
       {
        $.post('{:url("index/member/getMemberInfo")}', {card_num: $('#card_num').val()}, function(data) {
                        if(data.sta ==1)/*正常用户*/
                        {
                            $('#money').val(data.money);
                        }else if(data.sta == 2)
                        {
                            swal({title: '该卡已被冻结',text: "",type: "error"});
                            document.getElementById('card_num').value = '' ; 
                        }else{
                            swal({title: '该卡号不存在',  text: "",type: "error"});
                            document.getElementById('card_num').value = '' ;
                        }
                    });
        return false;
       }
     }); 
     /*会员卡验证密码的功能*/
        $('#pass').bind('keydown', function(event) {
            if(event.keyCode == '13')
            {
                $.post('{:url("index/member/checkPassword")}', {password: $('#pass').val(),card_num: $('#card_num').val()}, function(data) {
                    if(data.sta != 1)
                    {
                       swal({title: '密码输入错误',  text: "",type: "error"}); 
                       document.getElementById('pass').value = '' ;
                       return false;
                    }else{
                        swal({title: '密码正确',  text: "",type: "success"});
                        return false;
                    }
                });
                return false;
            }
        });
  });

</script>
{/block}